package backend.util;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class ExFileWriter extends FileWriter{
	
	private File file;
	private long singleFileSize;
	
	public boolean insidePermittedSize(){
		if(file == null||!file.exists())return true;
		return singleFileSize!=0 ? file.length() <= singleFileSize:false;
	}
	
	public long getLength(){
		if(file == null||!file.exists())return 0;
		return file.length();
	}
	
	public File fetchFile(){return file;}
	
	
	public ExFileWriter(String write2File, boolean append, long singleFileSize) throws IOException{
		super(write2File,append);
		file = new File(write2File);
		this.singleFileSize = singleFileSize;
	}

}
